@extends('layouts.tankuang')

@section('content')
    <!--startprint-->
    <form name="add_form" id="add_form" method="post" action="{{url('admin/units/edit',$id)}}" enctype="multipart/form-data">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <div id="div_print" style="margin-bottom: 40px;">
            <h2 class="text-center mg_b36 mg_t25">企事业单位基本情况登记表</h2>
            <table class="table-form table-border mg-auto" border="false">
                <tbody>
                <tr>
                    <td>单位名称</td>
                    <td colspan="4">{{$re->name}}</td>
                    @if($re->pic != '')
                    <td  rowspan="2">
                    	<div class="example  col-md-12 col-xs-12 "><img src="{{ URL::asset('/') }}{{$re->pic}}" class="img-rounded" alt="" width="80"></div>
                    </td>
                    @endif
                </tr>
                <tr>
                	<td>市区派出所</td>
                    <td colspan="4">{{getValue($re->city,'area','id','name')}}{{getValue($re->area,'area','id','name')}}{{getValue($re->org_id,'area','id','name')}}</td>
                </tr>
                <tr>
                    <td>详细地址</td>
                    <td colspan="3">{{$re->address}}</td>
                    <td>机构代码</td>
                    <td></td>
                </tr>
                <tr>
                	<td>重点级别</td>
                	<td>
                		@if($re->is_imp == 1)省级
                        @elseif($re->is_imp == 2)市级
                        @elseif($re->is_imp == 3)县级
                        @elseif($re->is_imp == 4)乡级
                            @else非重点
                            @endif
                	</td>
                	<td>单位性质</td>
                	<td>
                        {{$re->xingzhi}}
                	</td>
                	<td colspan="2"></td>
                </tr>
                <tr>
                	<td>行业类别</td>
                	<td>
                        {{getValue($re->type,'unit_type','id','name')}}
                    </td>
                	<td></td>
                	<td></td>
                	<td></td>
                	<td></td>
                </tr>
                <tr>
                	<td>法人</td>
                	<td>{{$re->frdb_name}}</td>
                	<td>联系电话</td>
                	<td>{{$re->frdb_phone}}</td>
                	<td></td>
                	<td></td>
                </tr>
                <tr>
                	<td>保卫负责人</td>
                	<td>{{$re->bwfzr_name}}</td>
                	<td>联系电话</td>
                	<td>{{$re->bwfzr_phone}}</td>
                	<td></td>
                	<td></td>
                </tr>
                <tr>
                	<td>责任民警</td>
                	<td>{{getValue($re->minjing,'admin_users','id','name')}}</td>
                	<td>联系电话</td>
                	<td>{{$re->minjing_phone}}</td>
                	<td></td>
                	<td></td>
                </tr>
                <tr>
                	<td>保卫人员数量</td>
                	<td>{{$re->hwd_num_of_peo}}</td>
                	<td>重点部位数量</td>
                	<td>{{$re->zdyhbw_num_of_peo}}</td>
                	<td>重点维稳人员数量</td>
                	<td>{{$re->zdwwgzdx_num_of_peo}}</td>
                </tr>
                <tr>
                	<td>单位状态</td>
                	<td colspan="5">
                        @if($re->status == 1)实有
                        @elseif($re->status == 2)变更
                        @elseif($re->status == 3)注销
                        @endif
                	</td>
                </tr>
                <tr>
                	<td>经度</td>
                	<td>{{$re->jd}}</td>
                	<td>纬度</td>
                	<td>{{$re->wd}}</td>
                	<td></td>
                	<td></td>
                </tr>
                <tr>
                    <td>备注</td>
                    <td colspan="5">
                        {{$re->remark}}
                    </td>
                </tr>
                </tbody>
            </table>
            <!--endprint-->
            <div class="wbt mg_t25 pd_b20 text-center">
                <a href="{{url('admin/units/print_unit',$id)}}" target="_blank" id="goToPageB" class="easyui-linkbutton dsp print" data-options="iconCls:'icon-print'">跳转至打印</a>
            </div>
        </div>
    </form>

    <link rel="stylesheet" href="{{ URL::asset('/') }}css/zoomify.min.css">
    <script src="{{ URL::asset('/') }}js/zoomify.min.js"></script>
    <script type="text/javascript">
        $('.example img').zoomify(function(){
            $(this).css({'position':'absolute','top':0,'bottom':0,'left':0,'right':0,'z-index':'9999',})
        });
    </script>
    <script type="text/javascript">
        $(document).on("change",'#city', function(){
            $('#area option:gt(0)').remove();
            $('#org_id option:gt(0)').remove();
            //alert(1);die;
            var cid = $("#city").val();
            var url = "{{url('admin/getArea')}}";
            $.getJSON(url,{cid:cid},function(json){
                /*清空原有的选项*/
                if(json != ''){
                    $.each(json,function(index,array){
                        var option = "<option value='"+array['id']+"'";
                        option += ">"+array['name']+"</option>";
                        $("#area").append(option);
                    });
                }
            });
        });

        $(document).on("change",'#area', function(){
            $('#org_id option:gt(0)').remove();
            var cid = $("#area").val();
            var url = "{{url('admin/getArea')}}";
            $.getJSON(url,{cid:cid},function(json){
                /*清空原有的选项*/
                if(json != ''){
                    $.each(json,function(index,array){
                        var option = "<option value='"+array['id']+"'";
                        option += ">"+array['name']+"</option>";
                        $("#org_id").append(option);
                    });
                }
            });
        });
    </script>
    <script>
        $('#go').click(function (){
            var formData = new FormData($("#add_form")[0]);
            $.ajax({
                type: "POST",
                url: "{{url('admin/units/edit',$id)}}",
                data: formData,
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                success: function(data) {
                    if(data.status == 1){
                        $.messager.alert('信息提示',data.msg,'info');
                        $('#w').dialog('close');
                        $('.pagination-load').click();
                    }else{
                        $.messager.alert('信息提示',data.msg,'info');
                    }
                }
            });
        });
    </script>
@stop